<style>
    #ingboy{
        font-size: 14px;
        width: 100%;
        height:330px;
    }
    #ingdetail{
        line-height: 36px;
        padding-left: 20px;
        padding-bottom: 10px;
    }
    #bf{
        background-color: #eee;
        text-align: right;
        width: 150px;
    }
    #cf{
        width: 200px;
    }
</style>
<div id="ingboy">
    <div id='ingdetail'>
        包裹信息
        <table width="720" border="1" cellpadding="0" cellspacing="0">
            <tr>
              <td id='bf'>所属用户：</td>
              <td id='cf'>&nbsp;&nbsp;<?php if($this->ingdetail->userinfo) echo $this->ingdetail->userinfo->nikename; else echo ''; ?></td>
              <td id='bf'>仓库号：</td>
              <td id='cf'>&nbsp;&nbsp;<?php echo $this->ingdetail->bystoreno->storeno;?></td>
            </tr>
            <tr>
              <td id='bf'>包裹名称：</td>
              <td id='cf'>&nbsp;&nbsp;<?php echo $this->ingdetail->name;?></td>
              <td id='bf'>提交时间：</td>
              <td id='cf'>&nbsp;&nbsp;<?php echo $this->ingdetail->createtime;?></td>
            </tr>
            <tr>
              <td id='bf'>物流单号：</td>
              <td id='cf'>&nbsp;&nbsp;[<?php echo $this->ingdetail->shipType;?>]<?php echo $this->ingdetail->shipNo;?></td>
              <td id='bf'>类型：</td>
              <td id='cf'>&nbsp;&nbsp;<?php echo "普通包裹"; ?></td>
            </tr>
            <tr>
              <td id='bf'>包裹备注：</td>
              <td id='cf' colspan="3">&nbsp;&nbsp;<?php echo $this->ingdetail->remark;?></td>
            </tr>
            <tr>
              <td id='bf'>状态：</td>
              <td id='cf' colspan="3">&nbsp;&nbsp;<?php
                            $stateStr = '';
                            switch ($this->ingdetail->state) {
                                case '-1':
                                    $stateStr = '已删除';
                                    break;
                                case '0':
                                    $stateStr = '等待入库';
                                    break;
                                case '1':
                                    $stateStr = '已入云仓库';
                                    break;
                                case '2':
                                    $stateStr = '已受理';
                                    break;
                                case '3':
                                    $stateStr = '已发贷';
                                    break;
                                case '4':
                                    $stateStr = '已入库';
                                    break;
                                case '5':
                                    $stateStr = '已出库';
                                    break;
                                default:
                                    $stateStr = '未知';
                                    break;
                            }
                            echo $stateStr;
                            ?></td>
            </tr>
            <tr>
              <td id='cf' colspan="4" align="center"><?php if ($this->ingdetail->state == 0) { ?>
                    <input type="button" id="edit-operation" naem="edit-operation" value="验货入库" />
                  <?php }  ?>&nbsp;&nbsp;
                  <input type="button" id="refo" naem="refo" value="返回" /></td>
            </tr>
          </table>
    </div>
</div>

<?php if($this->ingdetail->type==2): ?>
<div id="ingboy">
    <div id='ingdetail'>
        包裹清单
        <table width="720" border="1" cellpadding="0" cellspacing="0">
            <tr>
              <td id='bf'>物品名：</td>
              <td id='bf'>图片:</td>
              <td id='bf'>价格：</td>
              <td id='bf'>数量：</td>
              <td id='bf'>物品属性：</td>
              <td id='bf'>物品状态：</td>
            </tr>
            <?php foreach($this->productdetail as $product): ?>
            <tr>
              <td id='cf'><?php echo  $product->productname ?></td>
              <td id='cf'><img width='100px' height='100px' src="<?php echo  $product->image ?>" ></td>
              <td id='cf'><?php echo  $product->price;?></td>
              <td id='cf'><?php echo  $product->qty;?></td>
              <td id='cf'>
                <?php 
                    if(unserialize($product->attribute)){
                        foreach(unserialize($product->attribute)as $k=>$v){
                          echo $k.':'.$v;
                          }
                        }else{
                          echo '无';
                        }
                ?>
              </td>
              <td id='cf'> <?php
                            $status = '';
                            switch ($product->status) {
                                case Application_Model_ingstoreproduct::Insert_Less:
                                    $status = '少货';
                                    break;
                                case Application_Model_ingstoreproduct::Insert_Error:
                                    $status = '发错货';
                                    break;
                                default:
                                    $status = '正常';
                                    break;
                            }
                            echo $status;
                            ?></td>

            
            </tr>
            <?php endforeach; ?>
          </table>
    </div>
</div>
<?php endif; ?>
<script type="text/javascript">
    $("#refo").click(function(){
        location.href = "/admini/managestore/ingstore/"; 
    });
    $("#edit-operation").click( function (){
        location.href = "/admini/managestore/instore/id/<?php echo $this->ingdetail->id;?>";
    });
</script>